package com.zwan.oam_rtc.utils.messages;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;

import java.nio.ByteBuffer;

public class XMLInfoMessage extends AbstractStruct {
    private byte[] messageBodyHeader = new byte[8];
    private byte[] callFlowId = new byte[20];
    private byte[] callStatus = new byte[4];
    private byte[] xmlString = new byte[600];


    private static int LENGTH = 8+624;

    /**
     * 返回消息写入buffer
     */
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(messageBodyHeader);
        bf.put(xmlString);
    }

    /**
     * buffer读出返回消息
     */
    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(messageBodyHeader);
        bf.get(xmlString);
    }


    @Override
    public int getLength() {
        return LENGTH;
    }

    public String getXmlString() {return  ByteTransfer.getString(xmlString); }

    public void setXmlString(String xmlString) {
        ByteTransfer.str2Byte(xmlString, this.xmlString);
    }

    public String getCallFlowId() {return  ByteTransfer.getString(callFlowId); }

    public void setCallFlowId(String callFlowId) {
        ByteTransfer.str2Byte(callFlowId, this.callFlowId);
    }

    public String getCallStatus() {return  ByteTransfer.getString(callStatus); }

    public void setCallStatus(String callStatus) {
        ByteTransfer.str2Byte(callStatus, this.callStatus);
    }


    public byte[] getMessageBodyHeader() {
        return messageBodyHeader;
    }
}
